package com.api.oa.services.impl;

import com.api.oa.mapper.OaOfficeNavMapper;
import com.api.oa.model.entity.OaOfficeNav;
import com.api.oa.services.IOaOfficeNavService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class OaOfficeNavServiceImpl implements IOaOfficeNavService {


    @Autowired
    private OaOfficeNavMapper oaOfficeNavMapper;

    @Override
    public Integer add(OaOfficeNav oaOrg) {
        return oaOfficeNavMapper.insert(oaOrg);
    }

    @Override
    public void remove(Long id) {
        oaOfficeNavMapper.delete(id);
    }

    @Override
    public Integer update(OaOfficeNav org) {
        return oaOfficeNavMapper.update(org);
    }

    @Override
    public PageInfo<OaOfficeNav> list(String key, Integer pageIndex, Integer pageSize) {
        PageHelper.startPage(pageIndex,pageSize);
        PageInfo<OaOfficeNav> pageInfo = new PageInfo<>(oaOfficeNavMapper.list(key));
        return pageInfo;
    }



    @Override
    public OaOfficeNav one(Long id) {
        return oaOfficeNavMapper.findOne(id);
    }
}
